<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue 3 条件渲染</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
 
</head>
<body>
    <div id="app">
        <div v-if="isDisplayed">如果'isDisplayed'为真，这段文字将显示。</div>
        <div v-if="type === 'A'">类型 A</div>
        <div v-else-if="type === 'B'">类型 B</div>
        <div v-else>既不是类型 A 也不是类型 B</div>

        <div v-show="!isDisplayed">CSS控制</div>
    </div>

    <script>
        const { createApp, ref, computed } = Vue;

        createApp({
            setup() {
                const isDisplayed = ref(true);
                const type = ref('A');
                const isVisible = ref(true);

                return { isDisplayed, type, isVisible };
            }
        }).mount('#app');
    </script>
</body>
</html>
